<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Magnolia</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Magnolia</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/magnolia_rb.html">
                magnolia.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000005">add</a>&nbsp;&nbsp;
      <a href="#M000006">delete</a>&nbsp;&nbsp;
      <a href="#M000004">get</a>&nbsp;&nbsp;
      <a href="#M000001">new</a>&nbsp;&nbsp;
      <a href="#M000003">search</a>&nbsp;&nbsp;
      <a href="#M000002">set_api_key</a>&nbsp;&nbsp;
      <a href="#M000008">tags_add</a>&nbsp;&nbsp;
      <a href="#M000009">tags_delete</a>&nbsp;&nbsp;
      <a href="#M000011">tags_find</a>&nbsp;&nbsp;
      <a href="#M000010">tags_replace</a>&nbsp;&nbsp;
      <a href="#M000007">update</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">

    <div id="class-list">
      <h3 class="section-bar">Classes and Modules</h3>

      Class <a href="Magnolia/Mark.html" class="link">Magnolia::Mark</a><br />
Class <a href="Magnolia/Tag.html" class="link">Magnolia::Tag</a><br />

    </div>


    <div id="aliases-list">
      <h3 class="section-bar">External Aliases</h3>

      <div class="name-list">
                        <table summary="aliases">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">get</td>
          <td>-></td>
          <td class="context-item-value">find</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">add</td>
          <td>-></td>
          <td class="context-item-value">create</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">delete</td>
          <td>-></td>
          <td class="context-item-value">destroy</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">update</td>
          <td>-></td>
          <td class="context-item-value">edit</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">tags_add</td>
          <td>-></td>
          <td class="context-item-value">add_tags</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">tags_delete</td>
          <td>-></td>
          <td class="context-item-value">delete_tags</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">tags_replace</td>
          <td>-></td>
          <td class="context-item-value">replace_tags</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">tags_replace</td>
          <td>-></td>
          <td class="context-item-value">rename_tags</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">tags_replace</td>
          <td>-></td>
          <td class="context-item-value">tags_rename</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">tags_find</td>
          <td>-></td>
          <td class="context-item-value">find_tags</td>
        </tr>
                        </table>
      </div>
    </div>


      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000005" class="method-detail">
        <a name="M000005"></a>

        <div class="method-heading">
          <a href="Magnolia.src/M000005.html" target="Code" class="method-signature"
            onclick="popupCode('Magnolia.src/M000005.html');return false;">
          <span class="method-name">add</span><span class="method-args">(mark = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <h2>Examples</h2>
<pre>
  Magnolia.add(:title        =&gt; 'Addicted To New',
              :description  =&gt; 'A great site!',
              :url          =&gt; 'http://addictedtonew.com/',
              :private      =&gt; 'false',
              :tags         =&gt; 'cool dude, lame tag, addicting',
              :rating       =&gt; 5)
</pre>
<h2>Options</h2>
<pre>
  :url          - A URL string. Must be valid (required)
  :title        - A title string (optional)
  :description  - A description string (optional)
  :private      - The bookmark’s privacy status; either 'true' or 'false' (optional)
  :tags         - A list of tags. This will completely replace any existing tags for each specified bookmark (optional)
  :rating       - An integer representing a star rating; 1-5 (optional)
</pre>
<h2>Return Value</h2>
<p>
Returns an array containing the added mark
</p>
        </div>
      </div>

      <div id="method-M000006" class="method-detail">
        <a name="M000006"></a>

        <div class="method-heading">
          <a href="Magnolia.src/M000006.html" target="Code" class="method-signature"
            onclick="popupCode('Magnolia.src/M000006.html');return false;">
          <span class="method-name">delete</span><span class="method-args">(marks = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <h2>Examples</h2>
<pre>
  delone      = Magnolia.delete(:id =&gt; 'java')
  delmultiple = Magnolia.delete(:id =&gt; 'java,perl,someotherid')
  deldiff     = Magnolia.destroy(:id =&gt; 'someid')
</pre>
<h2>Options</h2>
<pre>
  :id - The short name for one or more bookmarks; seperate multiples with commas (required)
</pre>
<h2>Return Value</h2>
<p>
Nuttin
</p>
        </div>
      </div>

      <div id="method-M000004" class="method-detail">
        <a name="M000004"></a>

        <div class="method-heading">
          <a href="Magnolia.src/M000004.html" target="Code" class="method-signature"
            onclick="popupCode('Magnolia.src/M000004.html');return false;">
          <span class="method-name">get</span><span class="method-args">(marks = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This method is basically like a Ruby on Rails <tt>find</tt> method. Pass it
a short name (which is basically an id) or comma-seperated short names and
it will return each mark that is found. Because it is similar to rails
<tt>find</tt> method, I have aliased it.
</p>
<h2>Examples</h2>
<pre>
  getone      = Magnolia.get(:id =&gt; 'rubyonrails')
  getmultiple = Magnolia.get(:id =&gt; 'rubyonrails,ruby,someotherid')
</pre>
<p>
If you like Ruby on Rails and think <tt>find</tt> is a more appropriate
name for the method, feel free to use it.
</p>
<pre>
  getdiff     = Magnolia.find(:id =&gt; 'id1')
</pre>
<h2>Options</h2>
<pre>
  :id - The short name for one or more bookmarks; seperate multiples with commas (required)
</pre>
<h2>Return Value</h2>
<p>
Returns an array of Marks.
</p>
        </div>
      </div>

      <div id="method-M000001" class="method-detail">
        <a name="M000001"></a>

        <div class="method-heading">
          <a href="Magnolia.src/M000001.html" target="Code" class="method-signature"
            onclick="popupCode('Magnolia.src/M000001.html');return false;">
          <span class="method-name">new</span><span class="method-args">(api_key)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This must be called before any of the other methods can be used. It sets a
class variable named <tt>api_key</tt> which all the other class methods use
when making requests.
</p>
<h2>Example</h2>
<pre>
  Magnolia.new('yourgreatsuperapikey')
</pre>
        </div>
      </div>

      <div id="method-M000003" class="method-detail">
        <a name="M000003"></a>

        <div class="method-heading">
          <a href="Magnolia.src/M000003.html" target="Code" class="method-signature"
            onclick="popupCode('Magnolia.src/M000003.html');return false;">
          <span class="method-name">search</span><span class="method-args">(options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This method searches for bookmarks that match certain criteria provided by
you. Ma.gnolia named this method <tt>bookmarks_find</tt> but I thought it
was more appropriately named <tt>search</tt>.
</p>
<h2>Examples</h2>
<pre>
  latest  = Magnolia.find(:person =&gt; 'jnunemaker') # will find my last ten bookmarks
  recent  = Magnolia.find(:person =&gt; 'jnunemaker', :limit =&gt; 20) # will find my last 20 bookmarks
  nice    = Magnolia.find(:person =&gt; 'jnunemaker', :tags =&gt; 'nice', :limit =&gt; 5) # will find my last 5 bookmarks tagged 'nice'
</pre>
<p>
Let&#8217;s get a bit trickier. Below will rescue from a request error such
as not enough information or person not found, etc.
</p>
<pre>
  begin
    marks = Magnolia.search(:person =&gt; 'jnunemaker')
    marks.each do |mark|
      puts mark.title, &quot; #{mark.id}&quot;
    end
  rescue Magnolia::RequestError =&gt; msg
    puts msg
  end
</pre>
<h2>Options</h2>
<pre>
  :tags   - Multiple tags are treated as an AND search; seperate multiples with commas
  :person - Multiple screen names are treated as an ‘OR’ search; seperate multiples with commas
  :group  - Multiple groups are treated as an ‘OR’ search; seperate multiples with commas
  :rating - Only bookmarks rated this value or higher will be returned
  :from   - Only bookmarks created after this date time will be returned
  :to     - Only bookmarks created before this date time will be returned
  :url    - Only return bookmarks with this url
  :limit  - A maximum number of bookmarks to return from search
</pre>
<h2>Return Value</h2>
<p>
Returns an array of Marks.
</p>
        </div>
      </div>

      <div id="method-M000002" class="method-detail">
        <a name="M000002"></a>

        <div class="method-heading">
          <a href="Magnolia.src/M000002.html" target="Code" class="method-signature"
            onclick="popupCode('Magnolia.src/M000002.html');return false;">
          <span class="method-name">set_api_key</span><span class="method-args">(api_key)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Sets the api key for all requests
</p>
        </div>
      </div>

      <div id="method-M000008" class="method-detail">
        <a name="M000008"></a>

        <div class="method-heading">
          <a href="Magnolia.src/M000008.html" target="Code" class="method-signature"
            onclick="popupCode('Magnolia.src/M000008.html');return false;">
          <span class="method-name">tags_add</span><span class="method-args">(mark = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <h2>Examples</h2>
<pre>
  Magnolia.tags_add(:id =&gt; 'rubyonrails', :tags =&gt; 'fast,simple')
</pre>
<p>
You can also use add_tags if <a href="Magnolia.html#M000008">tags_add</a>
seems backwards.
</p>
<pre>
  Magnolia.add_tags(:id =&gt; 'rubyonrails', :tags =&gt; 'fast,simple')
</pre>
<h2>Options</h2>
<pre>
  :id     - One or more bookmark short names to which the specified tags should be added
  :tags   - Tags to be added to the specified bookmarks
</pre>
<h2>Return Value</h2>
<p>
Nuttin
</p>
        </div>
      </div>

      <div id="method-M000009" class="method-detail">
        <a name="M000009"></a>

        <div class="method-heading">
          <a href="Magnolia.src/M000009.html" target="Code" class="method-signature"
            onclick="popupCode('Magnolia.src/M000009.html');return false;">
          <span class="method-name">tags_delete</span><span class="method-args">(mark = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <h2>Examples</h2>
<pre>
  Magnolia.tags_delete(:id =&gt; 'java', :tags =&gt; 'cool,fun')
</pre>
<p>
You can also use add_tags if <a href="Magnolia.html#M000008">tags_add</a>
seems backwards.
</p>
<pre>
  Magnolia.add_tags(:id =&gt; 'id1', :tags =&gt; 'newtag1,newtag2')
</pre>
<h2>Options</h2>
<pre>
  :id     - One or more bookmark short names to which the specified tags should be added
  :tags   - Tags to be added to the specified bookmarks
</pre>
<h2>Return Value</h2>
<p>
Nuttin
</p>
        </div>
      </div>

      <div id="method-M000011" class="method-detail">
        <a name="M000011"></a>

        <div class="method-heading">
          <a href="Magnolia.src/M000011.html" target="Code" class="method-signature"
            onclick="popupCode('Magnolia.src/M000011.html');return false;">
          <span class="method-name">tags_find</span><span class="method-args">(mark = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <h2>Examples</h2>
<pre>
  tags = Magnolia.tags_find(:person =&gt; 'jnunemaker')
  tags.each do |tag|
    puts tag.name
  end
</pre>
<p>
You can also use the alias of find_tags if it makes more sense to you
</p>
<pre>
  tags = Magnolia.find_tags(:person =&gt; 'jnunemaker')
</pre>
<h2>Options</h2>
<pre>
  :person - The person whose tags you would like to find
</pre>
<h2>Return Value</h2>
<p>
An array of <a href="Magnolia/Tag.html">Tag</a> objects
</p>
        </div>
      </div>

      <div id="method-M000010" class="method-detail">
        <a name="M000010"></a>

        <div class="method-heading">
          <a href="Magnolia.src/M000010.html" target="Code" class="method-signature"
            onclick="popupCode('Magnolia.src/M000010.html');return false;">
          <span class="method-name">tags_replace</span><span class="method-args">(mark = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <h2>Examples</h2>
<pre>
  Magnolia.tags_replace(:id =&gt; 'languages', :old =&gt; 'java', :new =&gt; 'rubyonrails')
</pre>
<p>
You can also use any of these below if you don&#8217;t like <a
href="Magnolia.html#M000009">tags_delete</a>
</p>
<pre>
  Magnolia.replace_tags(:id =&gt; 'languages', :old =&gt; 'java', :new =&gt; 'rubyonrails')
  Magnolia.rename_tags(:id =&gt; 'languages', :old =&gt; 'java', :new =&gt; 'rubyonrails')
  Magnolia.tags_rename(:id =&gt; 'languages', :old =&gt; 'java', :new =&gt; 'rubyonrails')
</pre>
<h2>Options</h2>
<pre>
  :id     - One or more bookmark short names to which the specified tags should be added
  :old    - Existing tag to be replaced
  :new    - New tag to replace existing tag
</pre>
<h2>Return Value</h2>
<p>
Nuttin
</p>
        </div>
      </div>

      <div id="method-M000007" class="method-detail">
        <a name="M000007"></a>

        <div class="method-heading">
          <a href="Magnolia.src/M000007.html" target="Code" class="method-signature"
            onclick="popupCode('Magnolia.src/M000007.html');return false;">
          <span class="method-name">update</span><span class="method-args">(mark = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <h2>Examples</h2>
<pre>
  Magnolia.update(:id           =&gt; 'someid',
                :title        =&gt; 'Addicted To New',
                :description  =&gt; 'A great site!',
                :url          =&gt; 'http://addictedtonew.com/',
                :private      =&gt; 'false',
                :tags         =&gt; 'cool dude, lame tag, addicting',
                :rating       =&gt; 5)
</pre>
<h2>Options</h2>
<pre>
  :id           - The short name for one bookmark (required)
  :url          - A URL string. Must be valid (optional)
  :title        - A title string (optional)
  :description  - A description string (optional)
  :private      - The bookmark’s privacy status; either 'true' or 'false' (optional)
  :tags         - A list of tags. This will completely replace any existing tags for each specified bookmark (optional)
  :rating       - An integer representing a star rating; 1-5 (optional)
</pre>
<h2>Return Value</h2>
<p>
Returns an array containing the updated mark.
</p>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>